package com.jcp.service.imple;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jcp.dao.RecordMapper;
import com.jcp.entity.Record;
import com.jcp.entity.Users;
import com.jcp.service.RecordService;
import com.jcp.util.LayuiData;

import tk.mybatis.mapper.entity.Example;

@Service
public class RecordServiceImple implements RecordService {
	
	@Autowired
	private RecordMapper rm;

	@Override
	public LayuiData<Record> selRecordMessageByPage(int page, int pageSize, String strLike) {
		// TODO Auto-generated method stub
		strLike="%"+strLike+"%";
		PageHelper.startPage(page, pageSize);
		Example example=new Example(Record.class);
		example.createCriteria().andLike("carNumber", strLike);
		List<Record> record=rm.selectByExample(example);
		PageInfo<Record> pageInfo=new PageInfo<Record>(record);
		LayuiData<Record> layuiData=new LayuiData<>(0, "", (int)pageInfo.getTotal(), pageInfo.getList());
		return layuiData;
	}

}
